#pragma once

//	draw ground plane

typedef struct {
	D3DXVECTOR3		pos;
	D3DXVECTOR3		normal;
	FLOAT tu;	FLOAT tv;
} CGroundPlaneVertex ,*pCGroundPlaneVertex;

#define FVF_GROUND_PLANE_VERTEX		D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1

class	CGroundPlaneManager
{
public:
    virtual HRESULT OneTimeSceneInit()                         { return S_OK; }
    virtual HRESULT InitDeviceObjects();
    virtual HRESULT RestoreDeviceObjects();
    virtual HRESULT FrameMove();
    virtual HRESULT Render();
    virtual HRESULT InvalidateDeviceObjects();
    virtual HRESULT DeleteDeviceObjects();
    virtual HRESULT FinalCleanup();

	HRESULT RenderPovRay( CString & strPovRay );

	CGroundPlaneManager(CProteinVistaRenderer * pView = NULL);

	LPDIRECT3DVERTEXDECLARATION9	m_pDeclGroundPlane;

	BOOL	IsCameraBelowGround();

	//	
	IDirect3DVertexBuffer9	* m_pVBGroundPlane;		
	CString					m_strTextureFilename;
	LPDIRECT3DTEXTURE9		m_pGroundPlaneTexture;

private:
	CProteinVistaRenderer * m_pProteinVistaRenderer;

	LPDIRECT3DDEVICE9 GetD3DDevice() { return m_pProteinVistaRenderer->GetD3DDevice(); }
};

